/**
 * file
 */
package com.tdkj.action.front.member.spaceManagement;

import java.sql.Timestamp;

import javax.annotation.Resource;

import com.opensymphony.xwork2.ActionContext;
import com.tdkj.action.BaseAction;
import com.tdkj.model.enterprisezone.BeanEnterprise;
import com.tdkj.model.enterprisezone.BeanEnterpriseNews;
import com.tdkj.model.enterprisezone.BeanEnterpriseProduct;
import com.tdkj.model.user.BeanUser;
import com.tdkj.service.enterprisezone.IBeanEnterpriseNewsService;
import com.tdkj.service.enterprisezone.IBeanEnterpriseProductService;
import com.tdkj.service.enterprisezone.IBeanEnterpriseService;
import com.tdkj.util.PublicConfing;

/**

 * FileName:     ReleaseProductsAction.java

 * @Description: TODO发布产品

 * All rights Reserved, Designed By ZTE-ITS

 * Copyright:    Copyright(C) 2010-2011

 * Company       天成科技有限公司

 * @author:    李兴建

 * @version    V1.0 

 * Createdate:         2012-5-27 上午11:47:19

 *

 * Modification  History:

 * Date         Author        Version        Discription

 * -----------------------------------------------------------------------------------

 * 2012-5-27       李兴建          1.0             1.0

 * Why & What is modified: <修改原因描述>

 */
public class ReleaseProductsAction extends BaseAction {
	private BeanEnterpriseProduct enterpriseProduct;
	private IBeanEnterpriseProductService enterpriseProductService;
	private IBeanEnterpriseService enterpriseService;

	public String save(){
		BeanUser user =  (BeanUser) ActionContext.getContext().getSession().get(PublicConfing.MEMBER_MEMBWE_OBJ_STRING_CONFIG);
		BeanEnterprise enterprise = user.getEnterprise();
		enterprise = enterpriseService.findById(enterprise.getId(), BeanEnterprise.class);
		enterpriseProduct.setPostTime(new Timestamp(System.currentTimeMillis()));
		enterpriseProduct.setEnterprise(enterprise);
		enterpriseProductService.save(enterpriseProduct);
		return "success";
	}

	public BeanEnterpriseProduct getEnterpriseProduct() {
		return enterpriseProduct;
	}

	public void setEnterpriseProduct(BeanEnterpriseProduct enterpriseProduct) {
		this.enterpriseProduct = enterpriseProduct;
	}

	@Resource
	public void setEnterpriseProductService(
			IBeanEnterpriseProductService enterpriseProductService) {
		this.enterpriseProductService = enterpriseProductService;
	}
	
	@Resource
	public void setEnterpriseService(IBeanEnterpriseService enterpriseService) {
		this.enterpriseService = enterpriseService;
	}
}
